package cn.xs.user.service.impl;


import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.xs.core.service.impl.BaseServiceImpl;
import cn.xs.user.dao.UserDao;
import cn.xs.user.entity.Sign;
import cn.xs.user.entity.User;
import cn.xs.user.service.UserService;

@Service("userService")
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {

	private UserDao userDao;

	@Resource
	public void setUserDao(UserDao userDao) {
		super.setBaseDao(userDao);
		this.userDao = userDao;
	}

	public User login(String account, String password) {
		return userDao.findUserByAccAndPwd(account,password);
	}

	@Override
	public void sign(String uid) {
		this.userDao.sign(uid);
	}

	@Override
	public Sign checkSign(String uid, String time) {
		return userDao.checkSign(uid, time);
	}

	@Override
	public int getSignCountByMonth(String uid) {
		List<Sign> result = userDao.getSignCount(uid);
		return result.size();
	}
	
}
